package imitate;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2024-02-01
 * Time:19:33
 * Text：495. 提莫攻击
 */
public class Text1 {
    public int findPoisonedDuration(int[] timeSeries, int duration) {
        int num = 0;
        for (int i = 0; i < timeSeries.length - 1; i++) {
            if (timeSeries[i] + duration < timeSeries[i + 1]) {
                num += duration;
            } else {
                num += timeSeries[i + 1] - timeSeries[i];
            }
        }
        return num += duration;
    }

    public static void main(String[] args) {

    }
}
